Skip to main content

Identity Document OCR API

This document outlines the details of the Identity Document OCR API.

API Description

Objective

The Identity Document OCR API extracts information from valid identity documents using optical character recognition (OCR) and returns the extracted data in JSON format. The API classifies documents as either KYC or KYB and identifies document types (PAN, Aadhaar, Driving License, GST certificate, etc).

InputOutput
An image of KYC or KYB documentsDocument classification, document ID identification, and extracted details from the document

API URL

https://ind-engine.thomas.hyperverge.co/v1/readIdentity

API Endpoint

readIdentity

Overview

The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.

Authentication

You need a unique pair of application ID ( appId ) and application key (appKey) from HyperVerge to verify your identity for accessing the API.

API Request Details

Method - POST

Headers

ParameterMandatory or OptionalTypeDescriptionValid Values
content-type Mandatory string This parameter defines the media type for the request payload.multipart/form-data
appIdMandatorystringThe application ID shared by HyperVergeNot Applicable - this is a unique value.
appKeyMandatorystringThe application key shared by HyperVergeNot Applicable - this is a unique value.
transactionIdMandatorystringThe unique ID for the customer journey.Not Applicable - this is a unique value related to a transaction in your application.

Input

The following table provides the details of the parameter required for the API's request body:

ParameterMandatory or OptionalDescriptionAllowed ValuesDefault Values
imageMandatory Provide an image of KYC or KYB documents, such as PAN, Aadhaar, Driving License and GST certificates The file format can be JPEG, PNG, TIFF, or PDFNot Applicable
Caution
  • If multiple images are sent to the server in the same call, only one of the images will be read. Hence it is advisable to only send one image per call.
  • If the PDF file has multiple pages, only the first page will be considered for the OCR extraction.

Request

The following code snippet demonstrates a standard curl request for the API:

curl --location --request POST 'https://ind-engine.thomas.hyperverge.co/v1/readIdentity' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'image=@"<Attach_the_image_file>"'

Success Responses

The following code snippets demonstrate a few success responses from the API for different document types and IDs:

{
"status": "success",
"statusCode": 200,
"result": {
"documentType": "KYC",
"documentId": "pan",
"details": {
"fieldsExtracted": {
"firstName": {
"value": "<First_Name_of_the_User>"
},
"middleName": {
"value": "<Middle_Name_of_the_User>"
},
"lastName": {
"value": "<Last_Name_of_the_User>"
},
"fullName": {
"value": "<Full_Name_of_the_User>"
},
"dateOfBirth": {
"value": "<Date_Of_Birth_in_DD-MM-YYYY_Format>"
},
"dateOfIssue": {
"value": "<Date_Of_Issue_in_DD-MM-YYYY_Format>"
},
"dateOfExpiry": {
"value": "<Date_Of_Expiry_in_DD-MM-YYYY_Format>"
},
"countryCode": {
"value": "<Country_Code>"
},
"type": {
"value": "<Type_of_PAN_Card>"
},
"address": {
"value": "<Address_Of_The_User>",
"houseNumber": "<House_Number>",
"additionalInfo": "<Additional_Address_Information>",
"province": "<Province>",
"district": "<District>",
"street": "<Street>",
"zipCode": "<Zip_Code>"
},
"gender": {
"value": "<Gender>"
},
"idNumber": {
"value": "<PAN_Number>"
},
"placeOfBirth": {
"value": "<Place_Of_Birth>"
},
"placeOfIssue": {
"value": "<Place_Of_Issue>"
},
"yearOfBirth": {
"value": "<Year_Of_Birth>"
},
"age": {
"value": "<Age>"
},
"fatherName": {
"value": "<Father_Name>"
},
"motherName": {
"value": "<Mother_Name>"
},
"husbandName": {
"value": "<Husband_Name>"
},
"spouseName": {
"value": "<Spouse_Name>"
},
"nationality": {
"value": "<Nationality>"
},
"mrzString": {
"value": "<MRZ_String>",
"idNumber": "<ID_Number_from_MRZ>",
"fullName": "<Full_Name_from_MRZ>",
"dateOfBirth": "<Date_Of_Birth_from_MRZ>",
"dateOfExpiry": "<Date_Of_Expiry_from_MRZ>",
"gender": "<Gender_from_MRZ>",
"nationality": "<Nationality_from_MRZ>"
},
"homeTown": {
"value": "<Home_Town>"
}
},
"croppedImageUrl": "<URL_To_Cropped_Image>"
},
"summary": {
"action": "<Action_Status>",
"details": []
}
},
"metaData": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
}
}

Success Response Details

The following table outlines the details of the success response from the API:

ParameterTypeDescription
statusstringThe status of the request
statusCodeintegerThe HTTP status code returned for the request
resultobjectContains the extracted details from the identity document
documentTypestringClassification of the document (KYC or KYB)
documentIdstringType of document (pan, dl, GST certificate, etc)
detailsobjectContains the extracted fields with their values and confidence scores
fieldsExtractedobjectContainer for all extracted fields from KYC documents
firstNameobjectThe first name of the document holder
middleNameobjectThe middle name of the document holder
lastNameobjectThe last name of the document holder
fullNameobjectThe complete name of the document holder
dateOfBirthobjectThe date of birth of the document holder
dateOfIssueobjectThe date when the document was issued
dateOfExpiryobjectThe expiry date of the document
countryCodeobjectThe country code associated with the document
typeobjectThe type or category of the document
addressobjectThe address information of the document holder
houseNumberstringThe house or building number in the address
additionalInfostringAdditional address information or landmarks
provincestringThe province or state in the address
districtstringThe district in the address
streetstringThe street name in the address
zipCodestringThe postal or zip code in the address
genderobjectThe gender of the document holder
idNumberobjectThe identification number of the document
placeOfBirthobjectThe place of birth of the document holder
placeOfIssueobjectThe place where the document was issued
yearOfBirthobjectThe year of birth of the document holder
ageobjectThe age of the document holder
fatherNameobjectThe name of the father of the document holder
motherNameobjectThe name of the mother of the document holder
husbandNameobjectThe name of the husband of the document holder
spouseNameobjectThe name of the spouse of the document holder
nationalityobjectThe nationality of the document holder
mrzStringobjectMachine Readable Zone string containing encoded document information
homeTownobjectThe hometown of the document holder
croppedImageUrlstringURL to the cropped image of the processed document
summaryobjectSummary information about the document processing
actionstringThe action status of the document processing
regNoobjectThe registration number for business documents
legalNameobjectThe legal name of the business entity
tradeNameobjectThe trade name of the business entity
businessConstitutionobjectThe constitution type of the business entity
dateLiabilityobjectThe date of liability for business documents
validFromobjectThe validity start date of the document
validTillobjectThe validity end date of the document
confnumberThe confidence score for the extracted field value
toBeReviewedstringIndicates whether the field value needs manual review
valuestringThe actual value extracted from the document field
metaDataobjectContains request and transaction identifiers
requestIdstringA unique identifier for the API request
transactionIdstringA unique identifier for the customer journey

Error Responses

The following are some error responses from the API:

{
"message": "No file or image found",
"statusCode": 400,
"status": "failure",
"metaData": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
}
}

Error Response Details

A failure or error response from the module contains a failure status, with a relevant status code and error message. The following table lists all error responses:

Status CodeError MessageError Description
400Missing required request parametersSome mandatory request parameters are missing in the API request made
400No file or image foundThe request did not contain the mandatory image file input
400Input Validation Error: requires property "image"The image parameter is missing from the request
400Invalid file type for: imageThe uploaded file format is not supported
401Missing/Invalid credentialsThe request is either missing the mandatory appId and appKey combination or has invalid values
403Access DeniedPlease contact HyperVerge for access permissions
422Document Not DetectedNo valid identity document could be detected in the provided image
500Internal Server ErrorPlease check the request headers or contact the HyperVerge team for resolution
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: